﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace VoxelBlock.VoxelInput
{ 
    public class RioVoxelData
    {
        public bool isOK;
        public string version = "v1.0";
        public Color32[] colors;
        public VoxelBoneTransform[] transforms;

        public VoxelUnitData[] allVoxel;

        public VoxelHeadData[] headDatas;

        public VoxelMaterial[] material;

        public RioVoxelData(bool isOK)
        {
            this.isOK = isOK;
        }
    }

    public class VoxelUnitData
    {
        public string name;

        public byte[] voxelData;

        /// <summary>
        /// 大小
        /// </summary>
        public Vector3Int size;

        /// <summary>
        /// 初始化坐标
        /// </summary>
        public Vector3 zero;

        /// <summary>
        /// 世界最小坐标
        /// </summary>
        public Vector3 min;

        /// <summary>
        /// 世界主要坐标
        /// </summary>
        public Vector3 world;

    }

    public class VoxelBoneTransform
    {
        public string name;
        public int index;
        public int layer = 0;
        public VoxelBoneTransform(string name, int index)
        {
            this.name = name;
            this.index = index;
        }

        public VoxelBoneTransform parent;
        public int parentIndex = -1;

        /// <summary>
        /// 中心点 ，模型相对世界中点偏移量 = 初始化坐标 - 当前世界偏移坐标 - 世界最小坐标
        /// pivot = zero - world - min
        /// </summary>
        public Vector3 pivot;

        public Vector3 localPosition;
        public Vector3 localEulerAngles;
        public Vector3 localScale;
        
    }


    public class VoxelHeadData
    {
        public string operationType;//加密操作 "encryption"        压缩操作"compress"
        public string operationData;
        public bool isOpen;
    }

    public class VoxelMaterial
    {

    }
}
